package com.cy.pj.brand.service.impl;

import com.cy.brand.service.BrandService;
import com.cy.pj.brand.pojo.Brand;
import com.cy.pj.brand.pojo.BrandDao;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BrandServiceImpl implements BrandService {
    private static final Logger log=
            LoggerFactory.getLogger(BrandServiceImpl.class);

    @Autowired
    private BrandDao brandDao;
    public List<Brand> findBrands(String name){
        long t1=System.currentTimeMillis();
        List<Brand> list=brandDao.findBrands(name);
        long t2=System.currentTimeMillis();
        log.info("findBrands->time->{}",(t2-t1));
        return list;
    }

    @Override
    public int deleteById(Integer id) {
        //1.参数校验
        //2.执行删除业务
        int rows=brandDao.deleteById(id);
        //3.校验结果并返回
        return rows;
    }
}